]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
shell: Drop shell_global_begin/end_modal()
authorCarlos Garnacho <carlosg@gnome.org>
Fri, 19 Nov 2021 13:36:53 +0000 (14:36 +0100)
committerCarlos Garnacho <carlosg@gnome.org>
Sat, 29 Jan 2022 01:19:14 +0000 (02:19 +0100)
These are no longer used nor necessary, we now use have ClutterGrab()
which notify the internals about the changes in event handling.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2046>

src/shell-global.c
src/shell-global.h

index e8705f5b08c757bf1da58933c56fd306ea9ddaeb..a603ab3840a86ab52ee15895d7dbf681a4bc9b21 100644 (file)
@@ -80,7 +80,6 @@ struct _ShellGlobal {
 
   GHashTable *save_ops;
 
-  gboolean has_modal;
   gboolean frame_timestamps;
   gboolean frame_finish_timestamp;
 
@@ -707,9 +706,6 @@ focus_window_changed (MetaDisplay *display,
 {
   ShellGlobal *global = user_data;
 
-  if (global->has_modal)
-    return;
-
   /* If the stage window became unfocused, drop the key focus
    * on Clutter's side. */
   if (!meta_stage_is_focused (global->meta_display))
@@ -736,9 +732,6 @@ sync_stage_window_focus (ShellGlobal *global)
 {
   ClutterActor *actor;
 
-  if (global->has_modal)
-    return;
-
   actor = get_key_focused_actor (global);
 
   /* An actor got key focus and the stage needs to be focused. */
@@ -767,10 +760,7 @@ sync_input_region (ShellGlobal *global)
   MetaDisplay *display = global->meta_display;
   MetaX11Display *x11_display = meta_display_get_x11_display (display);
 
-  if (global->has_modal)
-    meta_x11_display_set_stage_input_region (x11_display, None);
-  else
-    meta_x11_display_set_stage_input_region (x11_display, global->input_region);
+  meta_x11_display_set_stage_input_region (x11_display, global->input_region);
 }
 
 /**
@@ -1076,74 +1066,6 @@ _shell_global_get_gjs_context (ShellGlobal *global)
   return global->js_context;
 }
 
-/**
- * shell_global_begin_modal:
- * @global: a #ShellGlobal
- *
- * Grabs the keyboard and mouse to the stage window. The stage will
- * receive all keyboard and mouse events until shell_global_end_modal()
- * is called. This is used to implement "modes" for the shell, such as the
- * overview mode or the "looking glass" debug overlay, that block
- * application and normal key shortcuts.
- *
- * Returns: %TRUE if we successfully entered the mode. %FALSE if we couldn't
- *  enter the mode. Failure may occur because an application has the pointer
- *  or keyboard grabbed, because Mutter is in a mode itself like moving a
- *  window or alt-Tab window selection, or because shell_global_begin_modal()
- *  was previously called.
- */
-gboolean
-shell_global_begin_modal (ShellGlobal       *global,
-                          guint32           timestamp,
-                          MetaModalOptions  options)
-{
-  if (!meta_display_get_compositor (global->meta_display))
-    return FALSE;
-
-  /* Make it an error to call begin_modal while we already
-   * have a modal active. */
-  if (global->has_modal)
-    return FALSE;
-
-  global->has_modal = meta_plugin_begin_modal (global->plugin, options, timestamp);
-  if (!meta_is_wayland_compositor ())
-    sync_input_region (global);
-  return global->has_modal;
-}
-
-/**
- * shell_global_end_modal:
- * @global: a #ShellGlobal
- *
- * Undoes the effect of shell_global_begin_modal().
- */
-void
-shell_global_end_modal (ShellGlobal *global,
-                        guint32      timestamp)
-{
-  if (!meta_display_get_compositor (global->meta_display))
-    return;
-
-  if (!global->has_modal)
-    return;
-
-  meta_plugin_end_modal (global->plugin, timestamp);
-  global->has_modal = FALSE;
-
-  /* If the stage window is unfocused, ensure that there's no
-   * actor focused on Clutter's side. */
-  if (!meta_stage_is_focused (global->meta_display))
-    clutter_stage_set_key_focus (global->stage, NULL);
-
-  /* An actor dropped key focus. Focus the default window. */
-  else if (get_key_focused_actor (global) && meta_stage_is_focused (global->meta_display))
-    meta_display_focus_default_window (global->meta_display,
-                                       get_current_time_maybe_roundtrip (global));
-
-  if (!meta_is_wayland_compositor ())
-    sync_input_region (global);
-}
-
 /* Code to close all file descriptors before we exec; copied from gspawn.c in GLib.
  *
  * Authors: Padraig O'Briain, Matthias Clasen, Lennart Poettering
index 60bda71313bf3b9fea0dd95e9a31e778cd611dca..d5e77ea3fe3b7dd7008b7f80e7761a6a11b6695e 100644 (file)
@@ -23,12 +23,6 @@ guint32        shell_global_get_current_time          (ShellGlobal *global);
 
 
 /* Input/event handling */
-gboolean shell_global_begin_modal            (ShellGlobal         *global,
-                                              guint32             timestamp,
-                                              MetaModalOptions    options);
-void     shell_global_end_modal              (ShellGlobal         *global,
-                                              guint32              timestamp);
-
 void     shell_global_set_stage_input_region (ShellGlobal         *global,
                                               GSList              *rectangles);